import requests

url = 'https://www.baidu.com'

headers = {
    # "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36"
    "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"
}

# 在请求头中带上User-Agent，模拟浏览器发送请求
# r = requests.get(url)
r = requests.get(url, headers=headers)

# 打印请求头信息
print(r.request.headers)

# 响应内容
print(r.text)
